#include <avr/io.h>
#include <avr/interrupt.h>
#include "source/uart/uart.h"
#include "source/prog_res/prog_res.h"
#include "source/timer/timer.h"
#include "source/keyboard/keyboard.h"
#include "source/encoder/encoder.h"
#include "source/adc/adc.h"
#include "source/dac/dac.h"
#include "source/prog_res/prog_res.h"
#include "source/lcd/lcd.h"
#include "source/menu/Menu.h"
#include "source/mux/mux.h"

extern unsigned char flag_manual;


int main(void)
{
 XMCRB |= 0x07;

 MCUCR&=~(1<<SRE);

 UART0Init();
 Init_Timer0();
 //Init_Timer2();
 Init_Timer1(50);
 Init_encoder();
 Init_dac();
 Init_adc();
 Init_prog_res();
 MenuInit();
 LCDInit();
 UART0Init();
 Init_mux();
 sei();

 set_handler1(10,button_poll);
 set_handler2(10,keyboard);
 //set_handler3(2000,show_ADC_on_LCD);
 //LDCsendStr("TEST");
 show_menu_on_LCD ();
 while(1)
 {
  //if (flag_manual) keyboard(); //remote control from PC
  read_adcs();
 }
 return 0;
}
